(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Biodiversity Heritage Library | Children's Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "Super Expander (1982)(Commodore)[a2]"

Programs created with Super Expander's special statements will 
not work on a machine without the Super Expander plugged in. 

Finally, the extra 3K memory expansion is provided automatically 
when you plug in the Super Expander . . . you will see the screen 
come up with approximately 3000 extra bytes of memory when 
you turn it on. 



GETTING STARTED 

1. Turn on your television set. 

2. Turn your VIC 20 off. 

3. Insert the cartridge. 

4. Turn the VIC 20 on. 

5. Your Super Expander is now activated and you may write 

programs in BASIC using the special commands, statements 
and functions listed below. 



. USING SUPER EXPANDER GRAPHICS 

A few special notes are in order before you begin working through 
the manual. To begin with, it should be noted that for purposes of 
graphics plotting, the Super Expander cartridge divides the 
screen area into 1 024, by 1024 coordinates. For example, if you 
type POINT1,512,512 you will draw a point at the very middle of 
the screen. These are "pseudo-coordinates" which means the 
VtC accepts inputs based on 1024x1024 dot coordinates and 
scales the plotting down to the VIC's actual screen size/resolution. 

A full range of graphic instructions is automatically added to your 
VIC's standard BASIC instruction set when you plug in the Super 
Expander cartridge. These instructions are listed and explained 
below. 



NOTE: WHEN WORKING WITH GRAPHICS THERE ARE TWO 
IMPORTANT PARAMETERS WHICH YOU MUST INCLUOE AT 

THEBEGINNlNGOFYOURPROGRAM.Thesesetupthegraphic 
screen so you can plot, include characters mixed with graphics, 

etc. The two graphic commands you should begin your program 
with are: GRAPHIC and COLOR. GRAPHIC sets the VIC in the 
"GRAPHIC MODE" you want to use, and "COLOR" specifies the 
colors you will be working with. 



INSTRUCTION 



GRAPHIC 
SCNCLR 

COLOR 

REGION 

DRAW 

POINT 

CIRCLE 

PAINT 

CHAR 

SOUND 



Prepares the screen for graphics 
Clears a graphic screen 

Select screen, border, character, and auxiliary 
colors 

Select character color 

Plots a line between two points 

Plots a single point 

Draw a circle, ellipse, or arc 

Fill in an enclosed area in a color 

Puts text on the graphic screen 

Set 4 tones and volume all at once 



FUNCTION 

RG R(x) 

RCOLR(x) 

RDOT(x,y) 

RPOTfx) 

RPEN(x) 

RJOY(x) 

RSND(x) 



RETURN VALUE 

Current graphic mode 
The value in a color register 
The color of a point on the screen 
The position of the game paddle 
The position of the light pen 
The position of the joystick 
The value in a sound register 



GRAPHIC n 

This sets up the graphic screen and activates the graphics 
instruction set. There are 5 different GRAPHIC modes, which are 
activated by typing GRAPH 1C and the number, as an instruction in 

your program. 

Example; 

itf GRAPHIC 2 

20 COLOR 1,2,3,4 

Type RUN and hit RETURN. 



Value of n 


1 
2 
3 
4 



Mode 

Text mode (normal) 
Multi-color mode 
High resolution mode 
Mixed muiti and high-res 
Return to text mode 



Mode is the VIC's normal text mode. Once the mode has been 
changed, the GRAPHIC 4 statement is used to return to this 
mode. 

In mode 1 , there are 80 points across a line, and 160 lines. Each 
point is drawn in one of the 4 color registers: screen color, border 
color, character color, or auxiliary color. A point placed in the 
screen color is invisible, since it is the same as the background; 
this can be used to erase other points. Points drawn in either the 
screen, border, or auxiliary colors will change instantly when 
these colors are changed. The character color is associated with 
each specific 4 dot by 1 6 dot space of the screen. This means that 
it a dot is plotted in that space in a character color, all other points 
in that space that were drawn in the character color will change to 
the new character color. 



In mode 2, there are 160 points across a line, and 160 lines. The 
points are half as wide as in mode 1 , and therefore give twice as 
fine resolution to the screen. However, the color resolution is 
more limited. Dots can be plotted only in a character color. Within 
each specific space on the screen, which is an 8 by 8 dot area, 
there can be only one character color, so you can only have dots in 
that color displayed on the screen. 

Mode 3 is a mixture of modes 1 and 2. When the character color is 
less than 8, the plotting is done in high resolution. When the 
character color is greater than 7, multi-color mode is in effect. 

Mode 4 returns the screen to text mode from a graphic mode. 
WARNING: if the VIC was already in text mode, this will mess up 
the VIC until you turn it off and then on again. 



SCNCLR 

This statement clears the entire graphic screen. It may be typed 
directly or included in a program line. 



COLOR sc 3 bo,ch 3 au 



This sets up the 4 different color registers. The variables here 
have these limits; 



sc 
bo 
ch 

au 



0to15 

0to7 

to 7 normal, 8 to 15 multi-color 

0to15 



The colors are: 







black 


1 


white 


2 


red 


3 


cyan 


4 


purple 


5 


green 


6 


blue 


7 


yellow 


a 


orange 


9 


light orange 


10 


pink 


11 


light cyan 


12 


light purple 


13 


light green 


14 


light blue 


15 


light yellow 




NOTE; in GRAPHIC 3 mode, character color numbers greater 
than 7 set multi-color mode. In this case, the actual character 
in that space is the color number minus 8. 

EXAMPLE: COLOR 1, 2, 3, 4 



REGION c 

This works like the COLOR statement, except that onfy the 
character color is affected 

EXAMPLE: REGION 7 



. TO xn, 



DRAW c, x1, y1 TO x2, y2 (TO x3, y3 
ynf 

or 
DRAWcTOx1,y1 [.„] 



This allows you to draw lines in the screen. The variable c is the 
color of the line, on the following chart: 



High- res 



Multi-color 






screen 


1 


character 


2 


character 


3 


character 



screen 
border 
character 
auxiliary 



The x and y variables are the coordinatesof the end-points of the 

line. The values of X and Yean be from to 1023. An X value of is 
the left edge of the screen, and X— 1 023 is the right edge, and the 
Y values determine the up-and-down position. The values from 
to 1 023 are scaled down to the actual {1 60 by 1 60 or 80 by 1 60) 
size of the screen. 



EXAMPLE 1: DRAW 1,0,0 TO 100, 100 

EXAMPLE 2: DRAW 1,0,0TO0, 100TO 100,100TO100,0TO0,0 



EXAMPLE 1 



EXAMPLES 




POINT c, x, y 

or 

POINT c, x1,y1,x2, y2, — , xn, yn 

Th is sets a point or poi nts on the screen in the specified color. The 
points are given in the to 1023 form. 

EXAMPLE 1 : POINT 1 , 500, 500 

EXAMPLE 2: POINT 2, 500, 500, 600, 600, 700, 700 



CIRCLE c, x, y, rx, ry l»as,ae] 

Where: c is the color register (see chart in DRAW statement) in 
which the circle is drawn 

x and y are the coordinates of the center of the circle 
rx and ry are width and height of the circle 
as and ae are the optional starting and ending angles of 
the arc, in gradians {0 to 1 00 degrees in a full circle) 



8 



EXAMPLE 1: CIRCLE 1,51 1,51 1,300, 400 
EXAMPLE 2: CIRCLE 1, 200, 900, 100, 100 
EXAMPLE 3: CIRCLE 2, 500, 600, 200, 300, 10, 70 

EXAMPLE 1 




EXAMPLE 2 




EXAMPLE 3 




PAINT c, x, y 

This paintsan enclosedarea in acolor. c is the color register, and x 
and y are any point within the area to be painted. Each area can 
only be painted once. Because of the color limitations of some 
GRAPHIC modes, some nearby shapes may be distorted by this 
operation. If an area is bounded by multi-color mode areas, it must 
be PAINTed in the multi-color mode. 



EXAMPLE; 10 GRAPHIC 1 

20 COLOR 1,7,0, 10 

30 CIRCLE 2, 51 1, 511, 200, 300 

40 PAINT 3, 511,511 

50 PAINT 1,511,0 



CHAR ro, co, "text" 

This will put normal text on a graphic screen. The ro and co 

variables are the row and column on which the text is to appear. 
The text can be any string variable ortext inside quote marks. Text 
should only be displayed when in the high-resolution mode, or the 
mixed mode, but never in multi-color mode. 

EXAMPLE: CHAR 1, 1, "HELLO THERE*' 



SOUND s1, s2, S3, s4, v 

This sets all 4 sound "speakers" and the volume control all at 
once. The S1 value is put into register 1 . If its value is less than 1 28, 
no sound will playfrom that speaker. The volume can range! rom 
(off) to 15. This lets you create multi-speaker sound effects. 

EXAMPLE; SOUND 225, 225, 225, t 15 



RGR(x) 

This function reads the graphic mode that was set with the 
GRAPHIC command. The value of x can be from to 255, and 
doesn't effect the result. 

EXAMPLE: X= RGR(0) 



RCOLR(x) 

« 
This reads the color from any of the 4 registers, depending on the 



value of x on the following table: 



COLOR REGISTER 






screen color 


1 


border color 


2 


character color 


3 


auxiliary color 



EXAMPLE: X= RCOLR{2} 



RDOT(x 5 y) 

This reads the color value of a dot on the screen. The values of x 
and y are the coordinates of the point, and the color value 
returned is the register of the color on that space. 

EXAMPLE: X= RD0T{511, 511} 



RPOT(x) 

This reads the value of the paddle. If x = 0, paddle X is read, and if 
x = 1, paddle Y is read. 



EXAMPLE: 10 GRAPHIC2:COLORl 1,6,6,6, 

20 X=RPOT(0):Y=RPOT(1):J=RJOY(0) 
30 IFJ=.12THEN:SCNCLR 
40 IFJ=4THEN:REGION2 
50 IFJ=8THEN:REG!ON6 
60 POINT2,X*4,Y*4:GOTO20 



RPEN(X) 

This reads the screen coordinate of the light pen. If x=(5, the X 
coordinate is returned, and if x=l, the Y coordinate. 

EXAMPLE: X = RPEN(0) 



RJOY(x) 

This reads the value of the joystick. The x variable must be 
between and 255, and has no effect on the outcome. 

EXAMPLE: 10 GRAPHlC2:COLOR1 1,6,6,6,:X=170:Y=170 

20 J=RJOY(0) 

30 x=X-H(JAND4)=4)-'-«JAND8)=8) 

40 Y=Y+((JAND1)=)-((JAND2)=2) 

50 P0INT3,X*3,Y*3:!FJ=128THEN:SCNC(_R 

60 GOTO20 



RSND(x) 

This reads the value of any of the sound registers, depending on 
the value of x from this chart: 

x sound register 



1 
2 
3 
4 
5 



sound 1 

sound 2 
sound 3 
sound 4 
volume 



WRITING SUPER EXPANDER MUSIC 



The Super Expander's music writing mode lets you play notes 
directly by typing on the keyboard, or, more important, by using 
the PRINT statement in your BASIC PROGRAMS. It is "interrupt 
driven", which lets music play while the program proceeds with 
other tasks. It is designed primarily for playing of music, as 
opposed to sound effects, and makes writing programs with 
chords much easier. 

Music mode is entered by holding down theCTRL key and hitting 
the left arrow (-*-). When you type this in quotes in a program a 

"reverse f ' should appear. This is a special symbol that shows you 
where music mode is included in your program. Now any key you 
type will be interpreted by the music package, until the RETURN 
key is hit. Here are the characters recognized by music mode: 



Character 

P 
Q 
V 

s 



Effect 

Screen echo on 
Screen echo off 
Volume selection 
Sound register selection 



O (the letter O, not the number) Octave selection 
7 Tempo selection 

r Rest for 1 beat 

C, D, E, F, G, A, B Play note 

# Play the next note sharp 

$ Play the next note flat 

RETURN Ends music mode 

When PRINTING strings of these characters, the semicolon (;) 
can be used to preventthe RETURN characterfrom ending music 
mode. 



The screen echo is normally off- Any characters recognized by the 
music package are not displayed on the screen. However, when 
the echo is turned on, they appear normally. 

Some of the letters recognized by music mode must be followed 
by a single digit. Here is a table of these letters and their 
associated numbers: 



Letter 


Numbers 


Value of numbers 


V 


0to9 


Is quietest, 9 loudest 


s 


1 to 4 


Speaker no. 


o 


1 to 3 


1 is lowet, 3 is highest 


T 


0to9 


Tempo 


The tempo 


is selected according to this chart: 


Tempo 


Beats per 


Duration of note 


number 


minute 


times 1/60 second 





900 


4 


1 


600 


6 


2 


450 


8 


3 


300 


12 


4 


225 


16 


5 


150 


24 


5 


112.5 


32 


7 


56.25 


64 


8 


28. 


128 


9 


14- 


255 



Each sound register has 3 complete octaves in its range. However, 
since register 2 is one octave higher than register 1, the three 
octaves are different. When playing notes in different sound 
registers, be sure that the octaves used are chosen correctly. 



Here are some examples of strings that play music (the reversed f 
symbol means hold down the CTRL Key and type the (eft arrow 
key at the top left corner of the keyboard). 

10PRINT"ALLTHESAMENOTEEI[EQ(O T7V9S103CS2C 

S3 01 C" 

20 PRINT "SCALE KTmD R=1 T3 V9 S2 01 CDEFGAB 02 

BDEF6AB 03 CDEF GAB" 

30 PRINT "CHORDS EIEL][ 



40 PRINT "S1 03 S2 02 #F S3 01 B"; 
50 PRINT "SI 03 E S2 02 A S3 02 C" 



T5 V9 S1 03 C S2 E S3 01 G"; 



IV. PROGRAMMABLE FUNCTION KEYS 

There are 8 functions that can be accessed with the function keys 
along with the SHIFT key. These are pre-assigned to the following: 



Key 



Text 



(1 


GRAPHIC 


f2 


COLOR 


f3 


DRAW 


f4 


SOUND 


f5 


CIRCLE 


re 


RUN + RETURN 


f7 


POINT 


fa 


LIST+ RETURN 



Any time you hit these keys, the characters with which they are 
programmed enter the input buffer exactly as if you had typed 
them in yourself. Each key can be programmed with up to 128 
characters, using the KEY command. 



KEY 

or 

KEYn, "string" 

The word KEY all by itself .makes the VIC display a list of all 8 func- 
tion keys and their current value. This is formatted on the screen so 
the contents of the strings can be edited by moving the cursor up to 
the string, making the desired change, and hitting RETURN, just 
like editing a program. You can change any key in the KEY MENU by 
changing the information inside the quotation marks and hitting 
return or by typing the KEY command using the format shown in the 
example below. 

When followed by a number, this command changes the string 
value of the key to the new vaiue. This can be up to 128 
characters, including cursor and color controls, the RETURN 
(CHR$(13)), or any other character. The keys can be changed 
under program control as well. 

EXAMPLE: KEY 1, "ISN'T IT AMAZING?" 



V. 3K MEMORY EXPANSION 

When the 3K cartridge is used to expand the ViC-20, the BASIC 
program area is changed so it starts at location 1024 ($0400). 

Note that with the 3K cartridge plugged in, on lyon-board memory 
(4096-8191 or $1000-1 FFF) can be used as VIC screen and hi- 
resolution graphics areas. 



SUPEREXPANDER 

PROGRAM 
EXAMPLES 

PROGRAM 1 



5 HEM TRIG PLOT CEKU 

»0 GKAPHIC2 

11 SCNCLR 

15 SC=INT{RND(1) *16> :CH=rNTfRND 

2« COL0RSC f SC,CK,l 

40 FR=HND{l)*l&0-*50 

!>£ AR-=RKD{11 *t*2 

60 TA=lNT(RNU(l)+.:i> 

It TFTA=lTHENAi1=RNEI(l>*100+S|MFR=KND 

80 X=0:GOSUb20$ 

9$ DRAW1,X,Y: Y0=Y 

180 FURX=)«TOlO24STEP20 

110 GOSUB^f* 

12* lFABS(Y-*0)>f>fl«THENil>RAWl ,X,¥ 

13$ DRAWlTOX,Y:V0= Y 

140 NEXT 

\bt FORX=1T02WtNEXT 

?.M tf=AM*SLN ( X/FR+AD) /UOfi <TA* ( H./FR+.W) 
210 Y=.112+Y:Ifr-tf<GTHt;KY^ 
220 IPYM&23THEKY*:021* 

2 3$ RETURN 



1)*8) ilFSC=CHTHRNJ5 



])*2pe450:CT=:NT(HSDU1 » •*) 



tlfCT-lTKEHY— V 



PROGRAM 2 



i a 

2-> 

:#9 

105 

liff 

ill 

12* 

mi 

:6b 

i?$ 

188 
185 
19/ 
131 

1?S 

a** 

2P* 
221 
2?2 
223 
999 



EM J-p py.RAM.iC 
GRAPHIC 2s COT.0R0.7, 1 f 1 2 
FCR1=1TD5:READX{I| ,Yf I) ,2 [1] :NEXT 

FCRI-ll'OS 

YY[I>=Y<I) 

XX(I)=X(L) 

ZZfl)-Z(I) 

POINT2,50fl+(200»:<X<m/(YYfr)<2»f(: 

HEXT;XC=07YC=22» 

A=A+20:R-A/57.29 

FORl=JTQ5 

»X{I]=<X(l)-XC'l*COSfR} + (Y.:iJ-^Cj*i:iN(R)HKC 
YY!l)-(V(T)-YCj*COK(Rl-»/X(l)-XCJ*SIN{RJ+yc+)«a 

NRX7 ,1=C3 ^ S * XXfrn/IYV<I, ''" :JP8)>S ** :AYn, = n *** ZZfin/fYV{I '* 3a * )M5hp( ' 

SGnClr 

F(JSr=lT04 

DRAW2,AX{b) ,AY(5)TOAX(n,AY{l) 

NbIXT 

RRAW2,AX( !) , AY ( 1) TOAX( 2( ,AYf2) 
DnAWZ,AXf3J,Ay(3JTOAXH),AY(4) 
nnAW2,AX(3J,Ay(3)TOAXtl).AYfl> 
DHAW2,AX(2< ,AY ( 2J TOAX( 4) ,AYf4) 
UCTOlfifl 

L.ATA-2fla f ?&,19B,-2»fl f 4?B,19fl,2|S«,2»,19l.2B*,a2a,lge,e,22g f -a«e 



PROGRAM 3 



si 

55 



ART ADAPTED PROM BYTE ARTICLE 



L^W-L 



118 
12<T 
UP 
14* 
1$$ 
229 
Zif 
249 
25p 
2<>P 
27P 
2Sp 
2^« 
3fiC 
3P1 
182 

j»n 

334 
310 
11* 
32? 
U3P 
34* 
35P 
355 
369 
361 
362 

3*0 
365 

3a* 
4pti 



REH GRAPHIC UBHO 
REM KiNRTIC STRING 

grapeei£2 

CULUF«l,p,5,5 

FOR L-pTU bp 0$ T I VA 1 

ClJ<CLE2p5ll#5]l 

NEXT 

COS U Milt 

Q=™D(i)/2+v25i 

FORL=0TO5t PETEPO ? 

CrRCLEf2 r bli, 511,1-, 5pp-L*0 

wexx 

GOSUbupP 

Q=KND(l}/2+.25 

rO*L-flTO503STEPO# 

ClRCr.R?,5J1 ,511-L*Q r bM-l* 

NEXT 

GQS WISP* 

FORL*-0TO2* » S?F I 1 if'/ 2 5 

ClHCLE2 r 5n+4pp*SIN(L) ,S11*4< 

wexT 

GOSUG.&Jftp 

FDRL-PTD2* T STEP 3T/ 5P 

CIRCLE? , 51 1+4PP*5IR [Lj 

NEXT 

GRAPHICl :Ull>lM( 7#P, V sFORL-;Ti>5 = fiCBTMTfRNDt J" 
B0=TNT;RMD(J>*16) :TFBO=SCTHEMipi 
CH-lNT<RWD(1f*aj ;iy(CH-SC>OR{CH=BO|THEE3p2 
MJ=TNT(RND( 1)*1*) : IF fMJ=5C) DR(AU-RD?CRIALI=CK)TKENJ»3 

CO LORE C x Hfl pCU , AU 

X=TMT(RND(lJ*lp2^JJV=TH , ?lRNDfl) 

yi-IMT(nKE(l)*iP2fl) 

Ci=P:C2-$ 

FOn.M=pTC?PP 

IFCl<lTHi;wCl = 5+TNT(RKEU)*lPJ :RE=INT JRND(i;- *3;- +1 

lFfi2<:TIICMDXrlJi|T[HN[J(lJ*Bl)-4Jli;T-lKT(nK33ll)*a:)-4PsDA-lNT (Hl«n(];*Rl)-4p 

TFC2<lTHEMDft=JNT(RMD(n*bl! -4p = C?=l^-IINT(UNE ! 1) * lp?1 

Jt=X+DX:Y-Y+raiJCl=-Xl+EA:Y:-yi>DR 

If (X<P1 Oft (X>1 02.1 JTHENDX- D* :X=X-»DX*2 



!>*COEfL1 ,75,181! 



S) ;+4W*COS(M/(L+l) r "?5-L*lp, I0p-L*l3 



';■ 



1P24J :tfl=INT(RtfDU>*.lp24) 



FF(Y<P( OR{Y>lP23l TElENDYr-DYfY-tfOV*/ 

I>(Xl^P)ORfXl>lp23ri"HRNE^=-DA=Xl-XllE^*2 

2F(Y:<*JOR(Y1>1^22)TRL>IDD=-DBiY1-M1HJR*? 

Cl=Cl-l:£2-C2-l 

tRAWppAifHppl ,Al{n,1JTOAt(M,2) ,Atfh,l) 

DRAHHE,X,YTOXl ,Y11 A* [M r PJ=X: A%{M r 1> -Yl Afc fM, 2( =X1 :«i-H. # -:3:).-Yi 

(JRXT:NEKT 

GO&UB900 

GRf^HTC4:COLCHlp2,6p6:PRINT*HOrE YOU LIKED THS> S-HOWL" >(ffi!UfB9| 

FORD- !TU2PPil!HnXT:ECN<."LHf RETURN 



i'HUE